import 'package:get/get.dart';
import 'logistics_detail_state.dart';

class LogisticsDetailLogic extends GetxController {
  final state = LogisticsDetailState();

  @override
  void onInit() {
    super.onInit();
    _loadLogisticsData();
  }

  /// 加载物流数据
  void _loadLogisticsData() {
    // 从路由参数获取订单信息
    final args = Get.arguments as Map<String, dynamic>?;
    
    if (args != null) {
      state.productInfo.value = args;
    }
    
    // 模拟物流单号
    state.trackingNumber.value = '773353957813746';
    
    // 模拟物流记录
    state.logisticsRecords.value = [
      {
        'status': '已完成',
        'description': '已签收，签收人凭取货码签收。',
        'isCompleted': true,
      },
      {
        'status': '已发货',
        'description': 'Lorem Ipsum is simply dumy text of printing and typesetting industry.',
        'isCompleted': false,
      },
      {
        'status': '已拣货',
        'description': 'Lorem Ipsum is simply dumy text of printing and typesetting industry.',
        'isCompleted': false,
      },
      {
        'status': '处理中',
        'description': 'Lorem Ipsum is simply dumy text of printing and typesetting industry.',
        'isCompleted': false,
      },
      {
        'status': '确认中',
        'description': 'Lorem Ipsum is simply dumy text of printing and typesetting industry.',
        'isCompleted': false,
      },
    ];
  }
}
